﻿using PMS.Data.Entities.Customers;
using System.Collections.Generic;

namespace PMS.Services.EntityServices.Messages
{
    /// <summary>
    /// Workflow message service
    /// </summary>
    public partial interface IWorkflowMessageService
    {
        #region Customer workflow for email
        /// <summary>
        /// Sends a welcome message to a customer
        /// 新注册用户发送欢迎邮件：
        /// 发送邮件触发条件：
        /// 1: EmailAccountSettings.Enabled 为True
        /// 2: 发送邮件账号(EmailAccount)存在(使用阿里云邮件推送服务)且设置了相应的账号密码
        /// 3：发送邮件模板存在且IsActive为True
        /// 任一条件不满足则中止邮件推送
        /// 
        /// </summary>
        /// <param name="customer">Customer instance</param>
        /// <param name="customerPwd">CustomerPassword output to Email if needed</param>
        /// <returns>Queued email identifier</returns>
        IList<int> SendCustomerRegisteredWelcomeEmail(Customer customer, string customerPwd = null);

        /// <summary>
        /// Sends an email validation message to a customer
        /// 当CustomerSettings.UserRegisterType为邮箱验证时，用户注册成功根据用户邮箱发送账号验证激活邮件
        /// </summary>
        /// <param name="customer">Customer instance</param>
        /// <returns>Queued email identifier</returns>
        IList<int> SendCustomerEmailValidationEmail(Customer customer);

        /// <summary>
        /// 当后台用户管理页修改用户密码后，发送用户账号密码更改邮件
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="customerPwd"></param>
        /// <returns>Queued email identifier</returns>
        IList<int> SendCustomerPasswordChangedEmail(Customer customer, string customerPwd = null);
        /// <summary>
        /// Sends password recovery message to a customer
        /// </summary>
        /// <param name="customer">Customer instance</param>
        /// <returns>Queued email identifier</returns>
        IList<int> SendCustomerPasswordRecoveryEmail(Customer customer);

        /// <summary>
        /// Batch Sends Greeting message to a customer of Birthday
        /// </summary>
        /// <param name="customers">Customer instance List</param>
        /// <returns>Queued email identifier</returns>
        IList<int> SendBirthdayGreetingEmail(IList<Customer> customers);

        /// <summary>
        /// Sends verifycode validation Email message to customer
        /// when customer changing EmailAccount
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="email">email address to send verify code</param>
        /// <returns></returns>
        IList<int> SendCustomerChangeEmailAccountEmail(Customer customer, string email);
        #endregion

        #region Workflow for SMS
        /// <summary>
        /// Send VerifyCode Message to customer
        /// </summary>
        /// <param name="toCustomer"></param>
        /// <param name="templateName"></param>
        /// <returns></returns>
        bool SendVerifyMessageToCustomer(Customer toCustomer, string templateName);
        #endregion
    }
}
